package com.hmj.util;

import com.hmj.javabean.User1;
import mapper.UserMapper1;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import java.util.List;


public class UserTest1 {
    SqlSession session;
    UserMapper1 mapper;

    @Before
    public void a(){
        SqlSessionFactory factory = MyBatisUtil.getSqlSessionFactory();
        session = factory.openSession(true);
        mapper = session.getMapper(UserMapper1.class);

    }
    @After
    public void b(){
        session.close();
    }

    @Test
    public void selectAll(){
        List<User1> user1s = mapper.selectAll();
        for (User1 user1 : user1s) {
            System.out.println(user1);
        }
    }


}

